

clear 
set scheme lean2, permanent
global pm = char(177)
set more off

gl date = c(current_date)
if c(os) == "MacOSX" gl user "/Users/`c(username)'"
else if c(os) == "Windows" gl user "C:\Users\\`c(username)'"
else if c(os) == "Unix" gl user "/usr/`c(username)'"
di "$user

set graphics on  
 

global path_data_processed "\data\processed"
global path_output "\data\output"

 
clear all
set more off

cd "$path_data_processed"
use "experimentRNall.dta", clear

cd "$path_output"
 


**** Does our treatment affect people's perceived most likely recession causes?
*******************************************************************************


foreach var of varlist republican democrat finlit_index{
gen mis_`var' = `var'==.
replace `var'=0 if `var'==.
}

replace log_income=0 if inc_NR==1

global controls age agesq female log_income inc_NR atleast_bachelor midwest south west republican democrat finlit_index mis_republican mis_finlit_index

drop if  ind_other==1
   


foreach var in  firm_insurance_resc{
gen treatment_`var'=treatment*`var' if `var'!=.
gen posterior_`var'=posterior*`var' if `var'!=.
gen updating_`var'=updating*`var' if `var'!=.
}



* Insurance within the firm:

 

foreach var in firm_insurance_resc{
ivreg2 jobinsecurity (posterior posterior_`var'=treatment treatment_`var') `var' $controls  , r, if `var'!=.
outreg2 using "het_firm_insurance.tex", replace keep(posterior posterior_`var') nocons tex(frag)
foreach depvar in jobloss jobfind{
ivreg2 `depvar' (posterior posterior_`var'=treatment treatment_`var') `var' $controls , r, if `var'!=.
outreg2 using "het_firm_insurance.tex", append keep(posterior posterior_`var') nocons tex(frag)
}
}

